--- %%NOBANNER%% -->
![]() | ![]() |
/*-------------------<---Start of Description-->---------------------\ | NAME: delindex; | | PURPOSE: drop an existing index from a dataset or a table; | |---------------------<---End of Description-->----------------------| |--------------------------------------------------------------------| |------------<---Start of Files or Arguments Needed-->---------------| | Usage: libname: libref; | | indata: dataset name; | | ndx: index variables | |-------------<---End of Files or Arguments Needed-->----------------| |--------------------------------------------------------------------| |------------------<---Start of Files Created-->---------------------| | Example: %delndx(sasuser,class,rse) | | Usage: %delindex(libname=,indata=,index=, outdata=&indata); | \-------------------<---End of Files Created-->---------------------*/ %macro delindex(libname=,indata=,index=, outdata=&indata); /*--------------------------------------------\ | Author: Duo Zhou; | | Created: 8-27-2001 10:58pm; | | Purpose: Delete the index for the dataset; | \--------------------------------------------*/ %*-- check if index exists; %let libname=%upcase(&libname); %let indata=%upcase(&indata); %let index=%upcase(&index); %if &outdata eq %then %do; %let outdata=&indata; %end; %*-- Check if index exists; %let ixnames=; proc sql noprint; select distinct indxname into :ixnames separated by " " from dictionary.indexes where libname="&libname" and memname="&indata"; quit; %put ........... Existing indexes are: &ixnames; %put ........... Name of index to drop is: &index; %if %index(&ixnames, &index)=0 %then %do; %put **************** index: &index does not exist; %end; %else %do; proc sql noprint; drop index &index from &libname..&outdata; %put ................. index : &index dropped from table &libname..&indata; quit; %end; %mend delindex;